
<template>
  <div class="component-image-view">
    <ImagePreview v-for="item in imageList" :width="100" :height="100" :src="item.url" :preview-src-list="[item.url]" />
  </div>
</template>

<script setup lang="ts">
import { listByIds, delOss } from "@/api/system/oss";
import { ComponentInternalInstance } from "vue";
import { OssVO } from "@/api/system/oss/types";
import { globalHeaders } from "@/utils/request";
import ImagePreview from "@/components/ImagePreview/index.vue";

const props = defineProps({
  // 文件对象信息
  modelValue: [String, Object, Array],
});

const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const imgList = ref<any[]>([]);
const dialogImageUrl = ref("");
const dialogVisible = ref(false);


const imageList = computed(() => {
  if (Array.isArray(props.modelValue)) {
    return props.modelValue
  } else if (props.modelValue instanceof Object) {
    return [props.modelValue]
  } else if (typeof props.modelValue === 'string') {
    return [{ url: props.modelValue, fileName: '' }]
  } else {
    return []
  }
});
// 预览
const handlePictureCardPreview = (file: any) => {
  dialogImageUrl.value = file.url;
  dialogVisible.value = true;
}

</script>

<style scoped lang="scss">
.component-image-view {
  dispaly: flex;
}
</style>
